package org.example.model;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class Cat {
    @Value("小黄")
    private String name;
    @Value("4")
    private int age;

    public Cat() {
        System.out.println("调用了无参构造方法");
    }

    public Cat(String name, int age) {
        this.name = name;
        this.age = age;
    }

    void eat(){
        System.out.println("小白一只白猫");
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
